package com.culture.web.controller.business;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.culture.system.domain.CultureProject;
import com.culture.system.service.ICultureProjectService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.culture.common.annotation.Log;
import com.culture.common.core.controller.BaseController;
import com.culture.common.core.domain.AjaxResult;
import com.culture.common.enums.BusinessType;
import com.culture.common.utils.poi.ExcelUtil;
import com.culture.common.core.page.TableDataInfo;

/**
 * 文化项目管理Controller
 *
 * @author lidongsheng
 * @date 2025-03-27
 */
@RestController
@RequestMapping("/business/cultureProject")
public class CultureProjectController extends BaseController
{
    @Autowired
    private ICultureProjectService cultureProjectService;

    /**
     * 查询文化项目管理列表
     */
    @PreAuthorize("@ss.hasPermi('business:cultureProject:list')")
    @GetMapping("/list")
    public TableDataInfo list(CultureProject cultureProject)
    {
        startPage();
        List<CultureProject> list = cultureProjectService.selectCultureProjectList(cultureProject);
        return getDataTable(list);
    }

    /**
     * 导出文化项目管理列表
     */
    @PreAuthorize("@ss.hasPermi('business:cultureProject:export')")
    @Log(title = "文化项目管理", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, CultureProject cultureProject)
    {
        List<CultureProject> list = cultureProjectService.selectCultureProjectList(cultureProject);
        ExcelUtil<CultureProject> util = new ExcelUtil<CultureProject>(CultureProject.class);
        util.exportExcel(response, list, "文化项目管理数据");
    }

    /**
     * 获取文化项目管理详细信息
     */
    @PreAuthorize("@ss.hasPermi('business:cultureProject:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(cultureProjectService.selectCultureProjectById(id));
    }

    /**
     * 新增文化项目管理
     */
    @PreAuthorize("@ss.hasPermi('business:cultureProject:add')")
    @Log(title = "文化项目管理", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody CultureProject cultureProject)
    {
        return toAjax(cultureProjectService.insertCultureProject(cultureProject));
    }

    /**
     * 修改文化项目管理
     */
    @PreAuthorize("@ss.hasPermi('business:cultureProject:edit')")
    @Log(title = "文化项目管理", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody CultureProject cultureProject)
    {
        return toAjax(cultureProjectService.updateCultureProject(cultureProject));
    }

    /**
     * 删除文化项目管理
     */
    @PreAuthorize("@ss.hasPermi('business:cultureProject:remove')")
    @Log(title = "文化项目管理", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(cultureProjectService.deleteCultureProjectByIds(ids));
    }
}
